package com.book.controller;


import com.book.model.TBook;
import com.book.service.TBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wx
 * @since 2023-10-13 18:04:30
 */
@RestController
@RequestMapping("/tBook")
public class TBookController {
    @Autowired
    private TBookService tBookService;

    @GetMapping("getAllBook")
    public List<TBook> getAllBook(){
      return tBookService.getAllBook();
    }
    @PostMapping("addBook")
    public void addBook(TBook tBook){
        tBookService.addBook(tBook);
    }
    @PutMapping("updateBook")
    public void updateBook(TBook tBook){
        tBookService.updateBook(tBook);
    }
    @DeleteMapping("deleteBook")
    public void deleteBook(Long id){
        tBookService.deleteBook(id);
    }
}
